/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidad;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pc
 */
@Entity
@Table(name = "seatcinema")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Seatcinema.findAll", query = "SELECT s FROM Seatcinema s"),
    @NamedQuery(name = "Seatcinema.findByCinemaID", query = "SELECT s FROM Seatcinema s WHERE s.seatcinemaPK.cinemaID = :cinemaID"),
    @NamedQuery(name = "Seatcinema.findBySeatID", query = "SELECT s FROM Seatcinema s WHERE s.seatcinemaPK.seatID = :seatID"),
    @NamedQuery(name = "Seatcinema.findByRowNo", query = "SELECT s FROM Seatcinema s WHERE s.rowNo = :rowNo"),
    @NamedQuery(name = "Seatcinema.findBySeatNo", query = "SELECT s FROM Seatcinema s WHERE s.seatNo = :seatNo")})
public class Seatcinema implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SeatcinemaPK seatcinemaPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "rowNo")
    private int rowNo;
    @Basic(optional = false)
    @NotNull
    @Column(name = "seatNo")
    private int seatNo;
    @JoinColumn(name = "cinemaID", referencedColumnName = "cinemaID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Cinema cinema;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "seatcinema")
    private List<Seatshowtime> seatshowtimeList;

    public Seatcinema() {
    }

    public Seatcinema(SeatcinemaPK seatcinemaPK) {
        this.seatcinemaPK = seatcinemaPK;
    }

    public Seatcinema(SeatcinemaPK seatcinemaPK, int rowNo, int seatNo) {
        this.seatcinemaPK = seatcinemaPK;
        this.rowNo = rowNo;
        this.seatNo = seatNo;
    }

    public Seatcinema(int cinemaID, int seatID) {
        this.seatcinemaPK = new SeatcinemaPK(cinemaID, seatID);
    }

    public SeatcinemaPK getSeatcinemaPK() {
        return seatcinemaPK;
    }

    public void setSeatcinemaPK(SeatcinemaPK seatcinemaPK) {
        this.seatcinemaPK = seatcinemaPK;
    }

    public int getRowNo() {
        return rowNo;
    }

    public void setRowNo(int rowNo) {
        this.rowNo = rowNo;
    }

    public int getSeatNo() {
        return seatNo;
    }

    public void setSeatNo(int seatNo) {
        this.seatNo = seatNo;
    }

    public Cinema getCinema() {
        return cinema;
    }

    public void setCinema(Cinema cinema) {
        this.cinema = cinema;
    }

    @XmlTransient
    public List<Seatshowtime> getSeatshowtimeList() {
        return seatshowtimeList;
    }

    public void setSeatshowtimeList(List<Seatshowtime> seatshowtimeList) {
        this.seatshowtimeList = seatshowtimeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (seatcinemaPK != null ? seatcinemaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Seatcinema)) {
            return false;
        }
        Seatcinema other = (Seatcinema) object;
        if ((this.seatcinemaPK == null && other.seatcinemaPK != null) || (this.seatcinemaPK != null && !this.seatcinemaPK.equals(other.seatcinemaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidad.Seatcinema[ seatcinemaPK=" + seatcinemaPK + " ]";
    }
    
}
